﻿$(document).ready(function () {
    //折叠菜单自适应父容器
    $("#divSysMenu").accordion({  
    fit:false
    });
   
    LoadMenu();
})

function LoadMenu() {
    
    $.post("../Menu/LoadUserMenu", {},
    function (result) {
        $('#divSysMenu').empty(); 
        for (var i = 0; i < result.length; i++) {
            var v_panle = result[i];
            var ulContent = "<ul class=''>";
            for (var j = 0; j < v_panle.Content.length; j++) {
                var v_menu = v_panle.Content[j]
                ulContent = ulContent + "<li><a href=\"" + v_menu.Url + "\">" + v_menu.Title + "</a></li>";
            }
           ulContent = ulContent + "</ul>";
           add(v_panle.Title, ulContent);
        }

    }, "json");
}


function add(plTtile,plContent) {
    $('#divSysMenu').accordion('add', {
        title: plTtile,
        content: plContent,
        iconCls: "icon-reload" 
    });

}